local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.TaskBase());

--任务内容: 邀请N个好友
-- cfg={
--     id="ugc_1_2"
--     finish=2, 邀请1位好友
-- }

function M.new(...)
	return M(...);
end;

function M.ctor(self,...)--构造函数
	M.super.ctor(self,...);
end;

function M.ClientInit(self)--客户端初始化
    M.super.ClientInit(self);
    if not self:IsComplete() then
        local con=game.Players.PlayerAdded:Connect(function(player)
            if player:IsFriendsWith(self.Player:GetUserId()) then
                self:UpdateProgress(1)
            end
        end)
        self:AddConnect(con)
    end
end

function M.ServerInit(self)--服务器初始化
    M.super.ServerInit(self);
    if not self:IsComplete() then
        local con=game.Players.PlayerAdded:Connect(function(player)
            if player:IsFriendsWith(self.Player:GetUserId()) then
                self:UpdateProgress(1)
            end

        end)
        self:AddConnect(con)
    end
end

function M.dtor(self)--析构函数
    M.super.dtor(self);
end;

return M